<!--{block return}-->
<script type="text/javascript" src="./source/plugin/iweitao_paipai/js/jquery.js"></script>
<script type="text/javascript" src="./source/plugin/iweitao_paipai/js/jquery.jqzoom-core.js"></script>

<script type="text/javascript">
$(document).ready(function (){
	jQuery = jQuery.noConflict();

	// 根据当前状态显示当前end
	jQuery.ajax({
		url : "plugin.php",
		type : "GET",
		dataType: "html",
		data : {
			id : 'iweitao_paipai:ajax',
			act : 'show_end',
			tid : '{$array["tid"]}',
			gid : '{$array["gid"]}'
		},
		success : function (data) {
			
			if(data== '1' ){
				jQuery('#pai_show_end').empty();
				jQuery('.pai').show();
			}else{
				jQuery('#pai_show_end').empty().html(data);
			}
			
		}
	});


	// 放大镜
	jQuery('.jqzoom').jqzoom({
        zoomType: 'standard',
        lens:true,
        preloadImages: true,
        alwaysOn:false,
        title:false
    });
	// 拍卖剩余时间
	// 设置倒计时提示
	var timer = jQuery('.show_time');
	show_time(timer);

	function show_time(obj){
		var day,hour,minute,second,time;
		var re='';
		var d = 3600*24;
		var h = 3600;
		var m = 60;
		time = obj.attr('end') - obj.attr('start');

		var t = setInterval(function(){
			//天
			day = parseInt(Math.floor(time/d));
			re += day>0 ? day + '天 ' : '';

			//小时
			hour = parseInt(Math.floor(time%(d)/h));
			re += hour > 0 ? ' ' + hour + '小时' : '';
			//分
			minute = parseInt(Math.floor(time%(h)/m));
			re += minute > 0 ? minute  +  '分' : '';

			//秒
			second = parseInt(Math.floor(time%m));
			re += second > 0 ? second + '秒' : '0';
			
			if(re=='0'){
				obj.parent().html('<span style="color:red;">拍卖结束</span>');
				clearInterval(t);
			}
			
			obj.show().html(re);
			re = '';
			time--;

		},1000);
		
	}


	// 结算
	jQuery("#checkout").live('click',function() {
		jQuery.ajax({
			url : "plugin.php",
			type : "GET",
			dataType: "html",
			data : {
				id : 'iweitao_paipai:ajax',
				act : 'checkout',
				tid : '{$array["tid"]}',
				gid : '{$array["gid"]}'
			},
			success : function (data) {
				showDialog(data,'right');
				location.reload();
			}
		})
	});

	// 确认收货
	jQuery("#pay").live('click',function() {
		if(!confirm('请确定收到货物后，才确定收货？')){
			return;
		}
		jQuery.ajax({
			url : "plugin.php",
			type : "GET",
			dataType: "html",
			data : {
				id : 'iweitao_paipai:ajax',
				act : 'pay',
				tid : '{$array["tid"]}',
				gid : '{$array["gid"]}'
			},
			success : function (data) {

				showDialog(data,'right');
				location.reload();
			}
		})
	});


	// 申请退款
	jQuery("#return").live('click',function() {
		if(!confirm('确定申请退款吗？')){
			return;
		}
		jQuery.ajax({
			url : "plugin.php",
			type : "GET",
			dataType: "html",
			data : {
				id : 'iweitao_paipai:ajax',
				act : 'return',
				tid : '{$array["tid"]}',
				gid : '{$array["gid"]}',
				orderid:'{$array["orderid"]}'
			},
			success : function (data) {
				alert(data);
				return;
				showDialog(data,'right');
				location.reload();
			}
		})
	});



});
</script>
<link rel="stylesheet" href="./source/plugin/iweitao_paipai/css/jquery.jqzoom.css" />
<style type="text/css">
.order_detail table{width:100%; border:1px solid #CCC; margin-bottom:20px;}
.order_detail table tr{height:35px;background-color:#F2F7FF;}
.order_detail table tr td{padding:8px; border-bottom:1px solid #CCC;}
#tbw{background:#FFFFFF;}
#main_div{height:450px; width:100%;float:left;}
.zoombox{width:45%;float:left;}
.zoompic{/*border:solid 1px #dfdfdf; padding:2px;*/background:url(./source/plugin/iweitao_paipai/image/loading2.gif) no-repeat 50% 50%; margin-top:5px;}
.zoompic img{border:1px solid #CCC;padding:2px;}
.sliderbox{height:76px;overflow:hidden;margin:6px 0 0 0; width:520px; margin-bottom:10px; margin-top:10px;}
.sliderbox .arrow-btn{width:38px;height:76px;background:url(./source/plugin/iweitao_paipai/image/arrow-btn.png) no-repeat;cursor:pointer;}
.sliderbox #btn-left{float:left;background-position:0 0;}
.sliderbox #btn-left.dasabled{background-position:0 -76px;}
.sliderbox #btn-right{float:right;background-position:-38px 0;}
.sliderbox #btn-right.dasabled{background-position:-38px -76px;}
.sliderbox .slider{float:left;height:76px;width:60%;position:relative;overflow:hidden;margin:0 0 0 3px;display:inline;}
.sliderbox .slider ul{position:absolute;left:0;width:999em;}
.sliderbox .slider li{float:left;width:63px; height:74px;text-align:center;}
.sliderbox .slider li img{border:solid 1px #dfdfdf; margin-right:10px; float:left;}
.sliderbox .slider li.current img{border:solid 2px #FF6699; border-radius:3px;}
.buy_detail{height:485px; width:400px; float:left;margin-top:5px; margin-left:10px;}
.buy_detail h1{font-size:25px;line-height:30px;margin-bottom: 15px;}
.buy_detail h1:hover{color:#FF7300;text-shadow:3px;}
/*.buy_detail ul {padding-top:20px;}*/
.buy_detail ul li{padding-bottom:20px; font-weight:bold;}
.buy_right_now{border:none;background-image: url("./source/plugin/iweitao_paipai/image/buy_button.png"); background-repeat: no-repeat; height:38px; width:130px;float:left; margin-right:20px; margin-left:10px;}
.plus_shopping_car{border:none;background-image: url("./source/plugin/iweitao_paipai/image/buy_button.png"); background-repeat: no-repeat; background-position: -132px 0; height:38px; width:155px;float:left;}
#main_button{height:50px; width:100%; margin-top:30px;float:left;}
.main_input{float:left; border:1px solid #CCC;border: 1px solid #A7A6AC;color: #666666;font-size: 12px;height: 15px; margin-right:10px; width: 102px;background:url(./source/plugin/iweitao_paipai/image/input.png);background-position: -406px -41px;height:20px;padding: 2px 3px;}
.increase{ margin-top: 3px;float:left; background-image: url("./source/plugin/iweitao_paipai/image/act.png"); background-position: 0 -32px; height:15px; width:15px; padding-left:10px;cursor: pointer;}
.decrease{ margin-top: 3px;float:left; background-image: url("./source/plugin/iweitao_paipai/image/act.png"); height:15px; width:15px;background-position: 0 -46px; padding-right:10px;cursor: pointer;}
#plus_but{float:left;}
.paimaibutton{margin-top:-5px; border:none; height:40px; width:126px; background: url("./source/plugin/iweitao_paipai/image/act2.png") no-repeat -127px -108px;cursor:pointer;float:right;}
.pai:hover{background:none repeat scroll 0 0 #FFF3D9}
.pai{margin-top:10px;padding-top:10px;padding:15px;height:40px;width:90%;background: none repeat scroll 0 0 #F9F9F9; border: 1px solid #EDEDED;}
.clearfix:after{clear:both;content:".";display:block;font-size:0;height:0;line-height:0;visibility:hidden;}
.clearfix{display:block;zoom:1}
ul#thumblist{display:block;}
ul#thumblist li{float:left;margin-right:2px;list-style:none;}
ul#thumblist li a{display:block;border:1px solid #CCC;}
ul#thumblist li a.zoomThumbActive{
    border:1px solid red;
}

.jqzoom{

	text-decoration:none;
	float:left;
}

/**根据当前状态显示当前**/
#pai_show_end{
	text-align: center;
	padding-top: 25px;
}
</style>
<div id='main_div'>
	<div class="zoombox">
		<!--大图-->
		<div class="zoompic clearfix">
		
			<a href="./data/attachment/forum/$array['focus']" rel="gal1" class="jqzoom" title="">
				<img src="./data/attachment/forum/$array['focus']"  width="300" height="300" onerror='javascript:this.src="./source/plugin/iweitao_paipai/image/pg_bg1.png"'/>
			</a>
		
		</div>
		<!--./大图-->
		<!--小图-->
		<div class="sliderbox">
			<!--<div id="btn-left" class="arrow-btn dasabled"></div>-->
			<div class="clearfix " >
				<ul id="thumblist">
				<!--{loop $focus $k $v}-->
					<!--{if $v}-->
					

					<li>
						<a  <!--{if $k==0}-->class='zoomThumbActive'<!--{/if}--> href='javascript:void(0);' rel="{gallery: 'gal1', smallimage: './data/attachment/forum/{$v}',largeimage: './data/attachment/forum/{$v}'}">
							<img src="./data/attachment/forum/{$v}" width="50" height="52" onerror='javascript:this.src="./source/plugin/iweitao_paipai/image/pg_bg1.png"'/>
						</a>
					</li>
					<!--{/if}-->
				<!--{/loop}-->



					

					
				</ul>
			</div>
			<!--<div id="btn-right" class="arrow-btn" style='float:left'></div>-->
		</div>
		<!--./小图-->
		
		
		
	</div>
	<div class='buy_detail'>
		<h2 style="font-weight:400;color:#444;">拍卖编号: {$array['serial_num']}</h2>
		<h1>{$array["title"]}</h1>
		<!--{if $max}-->
		<h2>最高出价：<span style="color:orange;">{$max['price']}</span>  出价人: <a href="home.php?mod=space&do=index&uid={$max['uid']}" target="_blank">{$max['username']}</a></h2>
		<!--{/if}-->
		<ul>
			<!--{if $admingroup == $_G['groupid']}-->
				<li>管理工具 : 
					<!--{if $array['freeze'] == 1}-->
						<a href='plugin.php?id=iweitao_paipai:act&act=unfreeze&tid={$tid}'>解冻交易</a>
					<!--{/if}-->
					<!--{if $array['freeze'] == 0}-->
						<A href='plugin.php?id=iweitao_paipai:act&act=freeze&tid={$tid}'>冻结交易</a>
					<!--{/if}-->
				</li>
			<!--{/if}-->
			<li>商品类型:&nbsp;&nbsp;{$array['type']} &nbsp;&nbsp;&nbsp;&nbsp;制作材料:&nbsp;&nbsp; {$array['made']}</li>
			<li>起拍价格:&nbsp;&nbsp;{$array['origin_price']} &nbsp;&nbsp;&nbsp;&nbsp;加价价格:&nbsp;&nbsp;{$array['add_price']}</li>
			<li>拍卖时间:{$array['date_start_f']}&nbsp;至&nbsp;{$array['date_end_f']}</li>

			<li>{$array['str']}</li>
			
			
		</ul>
		
		<!--根据商品状态显示当前-->
		<div id="pai_show_end">
			<img src="./source/plugin/iweitao_paipai/images/zoomloader.gif" alt="">
		</div>
		<!--./根据商品状态显示当前-->

		
		<div class='pai' style="display:none;">
			<span style='float:left;margin-right:10px;padding-top:4px;'>竞拍价格:</span>
			<div class="decrease"></div><!--{eval $present = $array["price"]+$array["add_price"];}-->
			<input type='text' name='price' id='getprice' class='main_input' maxlength='8' value='{$present}'>
			<div class="increase"></div>
			<input class="paimaibutton"  id="paimaibutton" type="button" value="" name="price">
		</div>

	
	</div>
</div>
<div class='order_detail'>
	<table>
		<Tr><td>用户名</td><td>出价时间</td><Td>价格</td><td>状态</td></tr>
		<!--{loop $detail $k $v}-->
			<!--{if $v['status'] == 2}--><tr><!--{else}--><tr id='tbw'><!--{/if}-->
				<Td>{$v['username']}</td>
				<Td><!--{eval $time = date('Y-m-d H:i:s',$v['time']);}-->{$time}</td>
				<Td>{$v['price']}</td>
				<Td>
				<!--{if $v['status'] == 1}-->
				领先
				<!--{elseif $v['status'] == 2}-->
				出局
				<!--{elseif $v['status'] == 3}-->
				<span style="color:orange;">订单已结算</span>
				<!--{elseif $v['status'] == 4}-->
				<b style="color:orange;">订单完成</b>
				<!--{elseif $v['status'] == -1}-->
				<b style="color:orange;">退款处理中</b>
				<!--{elseif $v['status'] == -2}-->
				<b style="color:orange;">退款完成</b>
				<!--{/if}-->





					
				</td>
		</tr>
		<!--{/loop}-->
	</table>
</div>
<script>

$(document).ready(function() {

	jQuery(".increase").click(function() {
		default_value= jQuery(".main_input").val();
		v = parseInt({$array['add_price']});
		a = parseInt(default_value);
		default_value = a+v;
		jQuery(".main_input").val(default_value);
	});
	jQuery(".decrease").click(function() {
		default_value= jQuery(".main_input").val();
		v = parseInt({$array['add_price']});
		default_value = default_value-v;
		if(default_value == 0) {
			return false;
		}
		jQuery(".main_input").val(default_value);
	});
	function getid_auc(id) {
		return document.getElementById(id);
	}
	jQuery("#paimaibutton").click(function() {
		jQuery.ajax({
			url : "plugin.php",
			type : "GET",
			dataType: "html",
			data : {
				id : 'iweitao_paipai:ajax',
				act : 'buy',
				tid : '{$array["tid"]}',
				gid : '{$array["gid"]}',
				price : getid_auc('getprice').value
			},
			success : function (data) {
				// alert(data);
				switch(data){
					case '1':
						showDialog("交易参与成功",'right');location.reload();
					break;
					case '-2':
						showDialog("对不起，该交易暂未开始或已结束",'alert');
					break;
					case '-3':
						showDialog("对不起，交易价格不合法",'error');
					break;
					case '-4':
						showDialog("对不起，请加价后操作",'error');
					break;
					case '-5':
						showDialog("对不起，您的积分不足",'error');
					break;
					case '-6':
						showDialog("对不起，商品发布人不可以参与拍卖",'error');
					break;
					case '-7':
						showDialog("对不起，当前交易冻结中",'error');
					break;
					case '-8':
						showDialog("请登录后操作",'error');
					break;
					default:
						showDialog("交易参与失败",'error');

				}
			
				
			}
		})
	});
});
</script>

<!--{/block}-->